let axios;
let message;
let AllUsers;
let echarts;
let AllDepartment;
let AllProject;
let AllCustomer;
let url = "/PublicMethodApi/GetAllFinanceCategory";

//修
var AllRole;
var AllPostion;

let UpLoadFileType = {
	tongyongwenjian: 8192,
}


function setecharts(_echarts) {
    echarts = _echarts
}

function http(_axios, _message) {
    axios = _axios
    message = _message
}
//注入Alluser数据,便于public的使用
function getAllUsers(usersList) {
    AllUsers = usersList
}
//注入AllDepartment数据,便于public的使用
function _getAllDepartment(AllDepartment) {
    AllDepartment = AllDepartment
}

//注入AllDepartment数据,便于public的使用
function _getAllProject(AllProject) {
    AllProject = AllProject
}

function _getAllCustomer(AllCustomer) {
    AllCustomer = AllCustomer
}


//加
function dcmAdd(arg1, arg2) {
    var r1, r2, m, n;
    try {
        r1 = arg1.toString().split(".")[1].length
    } catch (e) {
        r1 = 0
    }
    try {
        r2 = arg2.toString().split(".")[1].length
    } catch (e) {
        r2 = 0
    }
    m = Math.pow(10, Math.max(r1, r2))
    n = (r1 >= r2) ? r1 : r2;
    return ((arg1 * m + arg2 * m) / m).toFixed(n);
}

//转换时间戳为年月日时分秒，最后只返回具体时间，不返回年月日
//转换时间戳
function formatTime(inputTime) {
    var result = "";
    if (inputTime != null || inputTime != undefined) {
        let date = new Date(parseInt(new RegExp(/\d+/).exec(inputTime)[0]));
        let y = date.getFullYear();
        let m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let minute = date.getMinutes();
        let second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        result = h + ': ' + minute + ': ' + second;
    }
    return result;
}

function dcmRedu(arg1, arg2) {
    var re1, re2, m, n;
    try {
        re1 = arg1.toString().split(".")[1].length;
    } catch (e) {
        re1 = 0;
    }
    try {
        re2 = arg2.toString().split(".")[1].length;
    } catch (e) {
        re2 = 0;
    }
    m = Math.pow(10, Math.max(re1, re2));
    n = (re1 >= re2) ? re1 : re2;
    return ((arg1 * m - arg2 * m) / m).toFixed(n);
}

//乘
function accMul(arg1, arg2) {
    var m = 0;
    var s1 = arg1.toString();
    var s2 = arg2.toString();
    try {
        m += s1.split(".")[1].length;
    } catch (e) { }
    try {
        m += s2.split(".")[1].length;
    } catch (e) { }

    return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);

}
// 除数，被除数， 保留的小数点后的位数
function accDiv(arg1, arg2, digit) {
    var t1 = 0, t2 = 0, r1, r2;
    try { t1 = arg1.toString().split(".")[1].length } catch (e) { }
    try { t2 = arg2.toString().split(".")[1].length } catch (e) { }
    r1 = Number(arg1.toString().replace(".", ""))
    r2 = Number(arg2.toString().replace(".", ""))
    //获取小数点后的计算值
    var result = ((r1 / r2) * Math.pow(10, t2 - t1)).toString()
    var result2 = result.split(".")[1];
    if (result2 != undefined){
        result2 = result2.substring(0, digit > result2.length ? result2.length : digit);
        return Number(result.split(".")[0] + "." + result2);
    }else{
        return Number(result.split(".")[0]);
    }
}

//金额小写转大写公式
function Arabia_To_SimplifiedChinese(/*Num*/n) {
    let fraction = ['角', '分'];
    let digit = [
        '零', '壹', '贰', '叁', '肆',
        '伍', '陆', '柒', '捌', '玖'
    ];
    let unit = [
        ['元', '万', '亿'],
        ['', '拾', '佰', '仟']
    ];
    let head = n < 0 ? '欠' : '';
    n = Math.abs(n);
    let s = '';
    for (let i = 0; i < fraction.length; i++) {
        s += (digit[Math.floor(Math.floor(n * 1000 * 10 * Math.pow(10, i)) % (10 * 1000) / 1000)] + fraction[i]).replace(/零./, '');
    }
    s = s || '整';
    n = Math.floor(n);
    for (let i = 0; i < unit[0].length && n > 0; i++) {
        let p = '';
        for (let j = 0; j < unit[1].length && n > 0; j++) {
            p = digit[n % 10] + unit[1][j] + p;
            n = Math.floor(n / 10);
        }
        s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
    }
    return head + s.replace(/(零.)*零元/, '元')
        .replace(/(零.)+/g, '零')
        .replace(/^整$/, '零元整');
};

//校验字符是否金额
function CheckAmount(number){
	var amtreg=/^\d+(\.\d{1,2})?$/;
	return amtreg.test(number)
}

//获取所有部门,包括已撤销部门
function GetAllDepartment(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllDepartment').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    AllDepartment = arr;
    return arr
}

// 拿取使用公章
function GetAllOfficialSeal(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllOfficialSeal').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    AllDepartment = arr;
    return arr
}

//获取所有的项目单位属性
function GetAllProjectUnitAttribute(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllProjectUnitAttribute').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    AllDepartment = arr;
    return arr
}

function NodGetAllGasCards(http) {
    var arr = [];
    http.get('PublicMethodApi/NodGetAllGasCards').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    return arr
}
function GetAllGasCards(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllGasCards').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    return arr
}
//获取物资状态
function GetAllDeviceState(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllDeviceState').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    return arr
}
//获取物资分类
function GetAllDeviceCategory(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllDeviceCategory').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    return arr
}
//获取所有的用户信息，不排除离职人员
function GetCompanyAllUsers(http) {
    var arr = [];
    http.get('PublicMethodApi/GetCompanyAllUsers').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    AllUsers = arr;
    return arr;
}
//获取所有的项目，排除已删除项目
function GetAllProject(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllProject').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    AllProject = arr;
    return arr;
}
//获取所有的项目，排除已删除项目
function GetAllCustomer(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllCustomer').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    AllCustomer = arr;
    return arr;
}
//获取所有设备
function GetAllDevice(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllDevice').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取所有设备
function GetAllContractType(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllContractType').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}
//获取所有合同
function GetAllContract(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllContract').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

// 获取所有汽车(不包括删除的数据)
function GetAllVehicle(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllVehicle').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}
// 获取所有汽车(包括删除的数据)
function GetAllVehicleAndok(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllVehicleAndok').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取收款方数据
function GetPayArray(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetPayArray').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取财务分类
function GetAllFinanceCategory(http) {
    var arr = [];
    http.get('/PublicMethodApi/GetAllFinanceCategory').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
};
//获取银行卡号
function GetAllFinanceBankCard(http) {
    var arr = [];
    http.get("/PublicMethodApi/GetAllFinanceBankCard").then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取快递公司
function GetAllExpressCompany(http) {
    var arr = [];
    http.get("/PublicMethodApi/GetAllExpressCompany").then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取银行卡号
function GetAllTypes(http) {
    var arr = [];
    http.get("/Qualification/GetAllTypes").then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

function GetDepartmentNameById(Id) {
    var name = "";
    var obj = AllDepartment.find((x) => x.Id == Id);
    if (obj != null && obj != undefined)
        name = obj.DepartmentName
    return name;
    //for (var i = 0; i < this.AllDepartment.length; i++) {
    //    if (this.AllDepartment[i].Id == Id) {
    //        return this.AllDepartment[i].DepartmentName;
    //    }
    //}
}

function GetProjectNameById(Id) {
    var name = "";
    var obj = AllProject.find((x) => x.Id == Id);
    if (obj != null && obj != undefined)
        name = obj.ProjectName
    return name;
    //for (var i = 0; i < this.AllProject.length; i++) {
    //    if (this.AllProject[i].Id == d) {
    //        return this.AllProject[i].ProjectName;
    //    }
    //}
}


function GetpayeerNameById(PayeeType, Id) {
    if (PayeeType == 1) {
        var name = "";
        var obj = AllCustomer.find((x) => x.Id == Id);
        if (obj != null && obj != undefined)
            name = obj.CustomerCompany
        return name;


    }
    else if (PayeeType == 2) {
        var name = "";
        var obj = AllUsers.find((x) => x.Id == Id);
        if (obj != null && obj != undefined)
            name = obj.UserName
        return name;
        //for (var i = 0; i < this.AllUsers.length; i++) {
        //    if (this.AllUsers[i].Id == Id) {
        //        return this.AllUsers[i].UserName;
        //    }
        //}
    }
}



//转换时间戳为年月日时分秒
//转换时间戳
function formatDateTime(inputTime) {
    var result = "";
    if (inputTime != null || inputTime != undefined) {
        let date = new Date(parseInt(new RegExp(/\d+/).exec(inputTime)[0]));
        let y = date.getFullYear();
        let m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let minute = date.getMinutes();
        let second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        result = y + '-' + m + '-' + d + ' ' + h + ': ' + minute + ': ' + second;
    }
    return result;
}

/**
 * 时间格式化
 * @param date  时间
 * @param format  格式
 * @returns {Promise<*>}
 */
function formatDate(date, format) {
    var o = {
        // 月
        "M+": date.getMonth() + 1,
        // 天
        "d+": date.getDate(),
        // 小时
        "h+": date.getHours(),
        // 分钟
        "m+": date.getMinutes(),
        // 秒
        "s+": date.getSeconds(),
        // 季度
        "q+": Math.floor((date.getMonth() + 3) / 3),
        // 毫秒
        S: date.getMilliseconds(),
    };
    if (/(y+)/.test(format))
        format = format.replace(
            RegExp.$1,
            (date.getFullYear() + '').substr(4 - RegExp.$1.length),
        );
    for (let k in o)
        if (new RegExp("(" + k + ")").test(format))
            format = format.replace(
                RegExp.$1,
                RegExp.$1.length == 1
                    ? o[k]
                    : ("00" + o[k]).substr(('' + o[k]).length),
            );
    return format;
}
function exportTable(name, data, columns) {
    let str = "<table><thead><tr>"
    let indexs = [];
    for (let i = 0; i < columns.length; i++) {
        if (columns[i].dataIndex) {
            indexs.push(columns[i].dataIndex);
            str += "<th>" + columns[i].title + "</th>"
        }
    }
    str += "</tr></thead><tbody>"
    for (let i = 0; i < data.length; i++) {
        str += "<tr>";
        for (let l = 0; l < indexs.length; l++) {
            if (typeof indexs[l] == "string") {
                if (typeof data[i][indexs[l]] == "object") {
                    str += "<td>" + JSON.stringify(data[i][indexs[l]]) + "</td>"
                } else {
                    str += "<td>" + data[i][indexs[l]] + "</td>"
                }
            } else {
                let key = data[i]
                for (let j = 0; j < indexs[l].length; j++) {
                    if (!key) {
                        key = null;
                        break;
                    } else {
                        key = key[indexs[l][j]]
                    }
                }
                if (typeof data[i][indexs[l]] == "object") {
                    str += "<td>" + JSON.stringify(key) + "</td>"
                } else {
                    str += "<td>" + key + "</td>"
                }
            }
        }
        str += "</tr>";
    }
    str += "</tbody>"
    try {
        var html = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"' +
            'xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>'
            + '<x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets>'
            + '</x:ExcelWorkbook></xml><![endif]-->' +
            ' <style type="text/css">' +
            'table th{' +
            'background-color: #f2f2f2;' +
            'border: 1px solid #e2e2e2;' +
            'font-size: 14px;' +
            'height: 30px;' +
            'vertical-align: middle;' +
            'text-align: center;' +
            '}' +
            'table td {' +
            'border: 1px solid #e2e2e2;' +
            'font-size: 12px;' +
            'height: 30px;' +
            'vertical-align: middle;' +
            'text-align: center;' +
            ' }' +
            '</style><meta charset=\'utf-8\' />' +
            '</head><body >' + str + '</body></html>';
        // 实例化一个Blob对象，其构造函数的第一个参数是包含文件内容的数组，第二个参数是包含文件类型属性的对象
        var blob = new Blob([html], {type: "application/x-xls"});
        var a = document.createElement("a");
        // 利用URL.createObjectURL()方法为a元素生成blob URL
        a.href = URL.createObjectURL(blob);
        // 设置文件名，目前只有Chrome和FireFox支持此属性
        a.download = name + ".xls"
        a.click();
        html = null;
    } catch (e) {
        console.log(e);
    }
}


//自动生成物资编号
function SetDeviceNumber(data, oldNumber = null, codes) {
    var a = codes.a
    var b = codes.b
    var c = codes.c
    // var a = data.DepartmentId
    // var b = data.DeviceCategoryIdOne
    // var c = data.DeviceCategoryIdTwo
    if (a == '' || a == null) {
        message.warning("该部门还没有设置物资编号编码，请确认编码后重试");
        data.DepartmentId = 0
        data.DeviceNumber = ''
        return false;
    }
    var res = b + c + a;
    if (oldNumber != null && oldNumber.startsWith(res)) {
        data.DeviceNumber = oldNumber
        return false;
    }
    if (a != '' && b != '' && c != '') {
        if (res.length != 3) {
            message.warning("前置编码存在问题，无法自动生成物资编号，请检查");
            return false;
        }
        //后去当前编码类型下的最大物资编号
        axios.get('Device/GetMaxDeviceNumber?data=' + res).then(res => {
            if (res.data.IsSuccess) {
                data.DeviceNumber = res.data.Msg
            } else {
                message.warning("自动构造物资编号失败，请重试");
            }
        })
    }
}

//去掉空数组
function DeleteNullArr(data) {
    var arr = [];
    $.each(data, function (i, d) {
        if (d.length != 0) {
            arr.push(d);
        }
    });
    return arr;
}

function arrayByIdtoobj(arr, id, str) {
    for (var i = 0; i < arr.length; i++) {
        if (arr[i].Id == id) {
            return arr[i][str];
        }
    }
}

//为各个单据页面数据初始化时的状态列初始化
function InitStateColum(d) {
    var result = "";
    if (d.State == 0) {
        result = "草稿";
    }
    else if (d.State == 1) {
        result = "待审批";
    }
    else if (d.State == 2) {
        if (d.IsRefuse) {
            result = "<span style='color:#FF5722'>第一级已拒绝</span>";
        }
        else {
            result = "<span style='color:#1E90FF'>第一级已同意</span>";
        }
    }
    else if (d.State == 4) {
        if (d.IsRefuse) {
            result = "<span style='color:#FF5722'>第二级已拒绝</span>";
        }
        else {
            result = "<span style='color:#7CFC00'>第二级已同意</span>";
        }
    }
    else if (d.State == 8) {
        if (d.IsRefuse) {
            result = "<span style='color:#FF5722'>第三级已拒绝</span>";
        }
        else {
            result = "<span style='color:#5e09f5'>第三级已同意</span>";
        }
    }
    else if (d.State == 16) {
        if (d.IsRefuse) {
            result = "<span style='color:#FF5722'>第四级已拒绝</span>";
        }
        else {
            result = "<span style='color:#009688'>第四级已同意</span>";
        }
    }
    else if (d.State == 32) {
        if (d.IsRefuse) {
            result = "<span style='color:#FF5722'>第五级已拒绝</span>";
        }
        else {
            result = "<span style='color:#108ae4'>第五级已同意</span>";
        }
    }
    else if (d.State == 64) {
        if (d.IsRefuse) {
            result = "<span style='color:#FF5722'>第六级已拒绝</span>";
        }
        else {
            result = "<span style='color:#fbb80a'>第六已同意</span>";
        }
    }
    if(d.IsAuditEnd){
        result += "<br/><span style='color:green'>审批完成</span>";
    }
    return result;
}


//转换时间戳为年月日,20210108修复负数时间戳的转换问题
function fmtDate(obj) {
    var result = "";
    if (obj != null || obj != undefined) {
        var data = parseInt(new RegExp(/\d+/).exec(obj)[0]);
        if (obj.indexOf("-") > 0)
            data = -data;
        var date = new Date(data);
        var y = 1900 + date.getYear();
        var m = "0" + (date.getMonth() + 1);
        var d = "0" + date.getDate();
        if (y > 1920 && y < 2099)
            result = y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length);
    }
    return result;
}

//返回两个数组中的差值(第一个参数数组长度小于后一个数组)
function getDiffentList(list_1, list_2) {
    let list_3 = JSON.parse(JSON.stringify(list_2))
    for (let i = 0; i < list_1.length; i++) {
        for (let j = 0; j < list_3.length; j++) {
            if (list_1[i].id == list_3[j].id) {
                list_3.splice(j, 1)
                break
            }
        }
    }
    return list_3
}


//为审批单据签字栏增加同意、拒绝文字
function AddAuditWord(data) {
    if (data.IsRefuse) {
        if (data.AuditUserId6 != undefined && data.AuditUserId6 != 0) {
            document.getElementById("audit6").innerHTML += "<span style='padding: 0px 20px;color: #F56C6C;'>拒绝</span>";
            document.getElementById("audit5").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit4").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit3").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit2").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit1").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        }
        else if (data.AuditUserId5 != undefined && data.AuditUserId5 != 0) {
            document.getElementById("audit5").innerHTML += "<span style='padding: 0px 20px;color: #F56C6C;'>拒绝</span>";
            document.getElementById("audit4").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit3").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit2").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit1").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        }
        else if (data.AuditUserId4 != undefined && data.AuditUserId4 != 0) {
            document.getElementById("audit4").innerHTML += "<span style='padding: 0px 20px;color: #F56C6C;'>拒绝</span>";
            document.getElementById("audit3").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit2").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit1").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        }
        else if (data.AuditUserId3 != undefined && data.AuditUserId3 != 0) {
            document.getElementById("audit3").innerHTML += "<span style='padding: 0px 20px;color: #F56C6C;'>拒绝</span>";
            document.getElementById("audit2").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
            document.getElementById("audit1").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        }
        else if (data.AuditUserId2 != undefined && data.AuditUserId2 != 0) {
            document.getElementById("audit2").innerHTML += "<span style='padding: 0px 20px;color: #F56C6C;'>拒绝</span>";
            document.getElementById("audit1").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        }
        else if (data.AuditUserId1 != undefined && data.AuditUserId1 != 0) {
            document.getElementById("audit1").innerHTML += "<span style='padding: 0px 20px;color: #F56C6C;'>拒绝</span>";
        }
    }
    else {
        if (data.AuditUserId1 != undefined && data.AuditUserId1 != 0)
            document.getElementById("audit1").innerHTML += "<span  style='padding: 0px 20px;color: #13e653;'>同意</span>";
        if (data.AuditUserId2 != undefined && data.AuditUserId2 != 0)
            document.getElementById("audit2").innerHTML += "<span  style='padding: 0px 20px;color: #13e653;'>同意</span>";
        if (data.AuditUserId3 != undefined && data.AuditUserId3 != 0)
            document.getElementById("audit3").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        if (data.AuditUserId4 != undefined && data.AuditUserId4 != 0)
            document.getElementById("audit4").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        if (data.AuditUserId5 != undefined && data.AuditUserId5 != 0)
            document.getElementById("audit5").innerHTML += "<span style='padding: 0px 20px;color: #13e653;'>同意</span>";
        if (data.AuditUserId6 != undefined && data.AuditUserId6 != 0)
            document.getElementById("audit6").innerHTML += "<span  style='padding: 0px 20px;color: #13e653;'>同意</span>";
    }
}

//根据userid获取userName,主要用于公司人员
function GetUserNameById(UserId) {
    var name = "";
    var obj = AllUsers.find((x) => x.Id == UserId);
    if (obj != null && obj != undefined)
        name = obj.UserName
    return name;
}

//根据userid获取userName,主要用于公司人员
function GetDataUserNameById(AllUsersArray, UserId) {
    var name = "";
    var obj = AllUsersArray.find((x) => x.Id == UserId);
    if (obj != null && obj != undefined)
        name = obj.UserName
    return name;
}



//转换正常时间为年月日时分秒，最后只返回具体时间，不返回年月日
function formatNormalTime(inputTime) {
    var type = typeof (inputTime);
    var result = "";
    if (inputTime != null && inputTime != "" && inputTime != undefined && type != "object")
        result = inputTime.replace("T", " ");
    return result;
}

//动态构造单据审批人信息
function AddAuditPeople(data, colspan, auditRule) {
    document.getElementById("auditPeople").innerHTML = ''
    if (auditRule == null)
        auditRule = {};
    data.AuditComment1 = data.AuditComment1 || "";
    data.AuditComment2 = data.AuditComment2 || "";
    data.AuditComment3 = data.AuditComment3 || "";
    data.AuditComment4 = data.AuditComment4 || "";
    data.AuditComment5 = data.AuditComment5 || "";
    data.AuditComment6 = data.AuditComment6 || "";
    if (data.AuditUserId1 != undefined && data.AuditUserId1 != 0) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第一级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit1' >" + GetUserNameById(data.AuditUserId1) + "</p><p style='text-align: right' id='time1'>" + formatNormalTime(data.AuditTime1) + "</p><p class='time' style='text-align: right' id='comment1'>" + data.AuditComment1 + "</p></td ></tr>";
    }
    else if (auditRule.AuditUserId1 != undefined && auditRule.AuditUserId1 != 0 && !data.IsAuditEnd) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第一级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit1' >" + GetUserNameById(auditRule.AuditUserId1) + "<span style='color: #E6A23C; padding-left: 10px;'>待签批</span></p></td ></tr>";
    }
    if (data.AuditUserId2 != undefined && data.AuditUserId2 != 0) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第二级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit2' >" + GetUserNameById(data.AuditUserId2) + "</p><p style='text-align: right' id='time2'>" + formatNormalTime(data.AuditTime2) + "</p><p class='time'  style='text-align: right' id='comment2'>" + data.AuditComment2 + "</p></td ></tr>";
    }
    else if (auditRule.AuditUserId2 != undefined && auditRule.AuditUserId2 != 0 && !data.IsAuditEnd) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第二级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit2' >" + GetUserNameById(auditRule.AuditUserId2) + "<span style='color: #E6A23C; padding-left: 10px;'>待签批</span></p></td ></tr>";
    }
    if (data.AuditUserId3 != undefined && data.AuditUserId3 != 0) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第三级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit3' >" + GetUserNameById(data.AuditUserId3) + "</p><p style='text-align: right' id='time3'>" + formatNormalTime(data.AuditTime3) + "</p><p class='time' style='text-align: right' id='comment3'>" + data.AuditComment3 + "</p></td ></tr>";
    }
    else if (auditRule.AuditUserId3 != undefined && auditRule.AuditUserId3 != 0 && !data.IsAuditEnd) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第三级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit3' >" + GetUserNameById(auditRule.AuditUserId3) + "<span style='color: #E6A23C; padding-left: 10px;'>待签批</span></p></td ></tr>";
    }
    if (data.AuditUserId4 != undefined && data.AuditUserId4 != 0) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第四级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit4' >" + GetUserNameById(data.AuditUserId4) + "</p><p style='text-align: right' id='time4'>" + formatNormalTime(data.AuditTime4) + "</p><p class='time' style='text-align: right' id='comment4'>" + data.AuditComment4 + "</p></td ></tr>";
    }
    else if (auditRule.AuditUserId4 != undefined && auditRule.AuditUserId4 != 0 && !data.IsAuditEnd) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第四级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit4' >" + GetUserNameById(auditRule.AuditUserId4) + "<span style='color: #E6A23C; padding-left: 10px;'>待签批</span></p></td ></tr>";
    }
    if (data.AuditUserId5 != undefined && data.AuditUserId5 != 0) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第五级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit5' >" + GetUserNameById(data.AuditUserId5) + "</p><p style='text-align: right' id='time5'>" + formatNormalTime(data.AuditTime5) + "</p><p class='time' style='text-align: right' id='comment5'>" + data.AuditComment5 + "</p></td ></tr>";
    }
    else if (auditRule.AuditUserId5 != undefined && auditRule.AuditUserId5 != 0 && !data.IsAuditEnd) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第五级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit5' >" + GetUserNameById(auditRule.AuditUserId5) + "<span style='color: #E6A23C; padding-left: 10px;'>待签批</span></p></td ></tr>";
    }
    if (data.AuditUserId6 != undefined && data.AuditUserId6 != 0) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第六级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit6' >" + GetUserNameById(data.AuditUserId6) + "</p><p style='text-align: right' id='time6'>" + formatNormalTime(data.AuditTime6) + "</p><p class='time' style='text-align: right' id='comment6'>" + data.AuditComment6 + "</p></td ></tr>";
    }
    else if (auditRule.AuditUserId6 != undefined && auditRule.AuditUserId6 != 0 && !data.IsAuditEnd) {
        document.getElementById("auditPeople").innerHTML += "<tr><td style='padding: 0 10px'>第六级签批</td><td style='padding: 0 10px' colspan=" + colspan + "><p style='text-align: right;font: italic bold 20px/30px arial,sans-serif;' id = 'audit6' >" + GetUserNameById(auditRule.AuditUserId6) + "<span style='color: #E6A23C; padding-left: 10px;'>待签批</span></p></td ></tr>";
    }
    AddAuditWord(data);
}

//文件下载
//下载文件并判断文件是否存在
function DownLoadFile(option) {
    axios.post('PublicMethodApi/IsExitFile', {
        id: option.id,
        FileType: option.FileType,
        Type: option.Type,
        FileName: option.FileName,
    }).then(res => {
        if (res.data.IsSuccess) {
            window.location.href = axios.defaults.baseURL + "PublicMethodApi/DownloadFile?id=" + option.id + "&FileType=" + option.FileType + "&Type=" + option.Type + "&FileName=" + option.FileName
        } else {
            message.warning("文件不存在");
        }
    })
}

 



//获取配置路径下所有的图片信息，并构造图片和加入相册
async function GetAllFileByUrl(http, url) {
    var arr = [];
    await http.get("/PublicMethodApi/GetUrlDocument?url=" + url).then(res => {
        for (var i = 0; i < res.data.data.length; i++) {
            arr.push(res.data.data[i]);
        }
    });
      return arr
}


//修
//月份计算
function monthdifference(date1, date2) { //sDate1和sDate2是2006-12-18格式
    // 拆分知年道月日
    date1 = date1.split('-');
    // 得到月数版权
    date1 = parseInt(date1[0]) * 12 + parseInt(date1[1]);
    // 拆分年月日
    date2 = date2.split('-');
    // 得到月数
    date2 = parseInt(date2[0]) * 12 + parseInt(date2[1]);
    return Math.abs(date1 - date2);
}


//修 获取所有权限
function GetAllRole(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllRole').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
   AllRole = arr;
    return arr
}

//获取所有职务
function GetAllDutyMains(http) {
    var arr = [];
    http.get('PublicMethodApi/GetAllDutyMains').then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    })
    return arr
}


/* 修 根据出生日期算出年龄*/
function jsGetAge(strBirthday) {
    var returnAge;
    var strBirthdayArr = strBirthday.split("-");
    var birthYear = strBirthdayArr[0];
    var birthMonth = strBirthdayArr[1];
    var birthDay = strBirthdayArr[2];

    var d = new Date();
    var nowYear = d.getFullYear();
    var nowMonth = d.getMonth() + 1;
    var nowDay = d.getDate();

    if (nowYear == birthYear) {
        returnAge = 0;//同年 则为0岁
    }
    else {
        var ageDiff = nowYear - birthYear; //年之差
        if (ageDiff > 0) {
            if (nowMonth == birthMonth) {
                var dayDiff = nowDay - birthDay;//日之差
                if (dayDiff < 0) {
                    returnAge = ageDiff - 1;
                }
                else {
                    returnAge = ageDiff;
                }
            }
            else {
                var monthDiff = nowMonth - birthMonth;//月之差
                if (monthDiff < 0) {
                    returnAge = ageDiff - 1;
                }
                else {
                    returnAge = ageDiff;
                }
            }
        }
        else {
            returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天
        }
    }
    return returnAge;//返回周岁年龄
}

//初始化多条折线图统计表格
function InitEchartRenderMore(id, title, dataList, valueList, seriesList, tipTitle) {
    var myChart = echarts.init(document.getElementById(id));
    let option = {
        title: {
            text: title
        },
        tooltip: {
            trigger: 'axis',
        },
        legend: {
            data: dataList
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: valueList
        },
        yAxis: {
            type: 'value',
        },
        series: seriesList
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option, true);
    //window.onresize = myChart.resize;
}
//初始化饼图统计表格
function InitEchartPie(id, title, subtitle, legendData, seriesName, seriesData) {
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(id));
    let option = {
        title: {
            text: title,
            subtext: subtitle,
            left: 'center'
        },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: legendData
        },
        series: [
            {
                name: seriesName,
                type: 'pie',
                radius: '55%',
                center: ['50%', '60%'],
                data: seriesData,
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}
//初始化带总量、且下方镂空柱状图统计表格
function InitEchartBar_Total(id, title, dataList, valueList, gapList, tipName ="今日完成量") {
    // 基于准备好的dom，初始化echarts实例
    let myChart = echarts.init(document.getElementById(id));
    let option = {
        title: {
            text: title,
            x: 'center',
            y: 30
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            },
            formatter: function (params) {
                var tar = params[1];
                return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            splitLine: { show: false },
            data: dataList
        },
        yAxis: {
            type: 'value'
        },
        legend: {
            orient: 'vertical',
            left: 'buttom',
            data: dataList,
            show: true
        },
        series: [
            {
                name: '辅助',
                type: 'bar',
                stack: '总量',
                itemStyle: {
                    barBorderColor: 'rgba(0,0,0,0)',
                    color: 'rgba(0,0,0,0)'
                },
                emphasis: {
                    itemStyle: {
                        barBorderColor: 'rgba(0,0,0,0)',
                        color: 'rgba(0,0,0,0)'
                    }
                },
                data: gapList
            },
            {
                name: tipName,
                type: 'bar',
                stack: '总量',
                label: {
                    show: true,
                    position: 'inside'
                },
                data: valueList
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}
//初始化带总量、且下方镂空柱状图统计表格
function InitEchartBar_TotalTwo(id, title, dataList, valueList, gapList, totalList = [],tipName ="今日完成量") {
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(id));
    let option = {
        title: {
            text: title,
            x: 'center',
            y: 30
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            },
            formatter: function (params) {
                var tar = params[1];
                if (totalList.length==0)
                    return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
                else
                    return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value + '<br/>' + "累积完成量" + totalList[tar.dataIndex];
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            splitLine: { show: false },
            data: dataList
        },
        yAxis: {
            type: 'value',
            axisLine: {					//---坐标轴 轴线
                show: true,
            }
        },
        legend: {
            orient: 'vertical',
            left: 'buttom',
            data: dataList,
            show: true
        },
        series: [
            {
                name: '辅助',
                type: 'bar',
                stack: '总量',
                itemStyle: {
                    barBorderColor: 'rgba(0,0,0,0)',
                    color: 'rgba(0,0,0,0)'
                },
                emphasis: {
                    itemStyle: {
                        barBorderColor: 'rgba(0,0,0,0)',
                        color: 'rgba(0,0,0,0)'
                    }
                },
                data: gapList
            },
            {
                name: tipName,
                type: 'bar',
                stack: '总量',
                label: {
                    show: true,
                    position: 'inside'
                },
                data: valueList
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}
//初始化显示多种数据统计的柱状图
function InitEchartBar_MoreData(id, title, dataList, valueList, gapList) {
    // 基于准备好的dom，初始化echarts实例
    let myChart = echarts.init(document.getElementById(id));
    let option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data: title
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            data: dataList
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '出账',
                type: 'bar',
                stack: '总量',
                label: {
                    show: true,
                    position: 'insideRight'
                },
                data: valueList
            },
            {
                name: '进账',
                type: 'bar',
                stack: '总量',
                label: {
                    show: true,
                    position: 'insideRight'
                },
                data: gapList
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}

//初始化折线图统计表格
function InitEchartRender(id, title, dataList, valueList, tipTitle) {
    let myChart = echarts.init(document.getElementById(id));
    let option = {
        title: {
            text: title,
            x: 'center',
            y: 30
        },
        grid: {
            x: 60,
            y: 80,
            x2: 100,
            y2: 70,
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross'
            },
            formatter: function (params) {
                var html = "时间:" + params[0].name + "<br/>";
                return html +=" 充值金额: " + params[0].value;
            }
        },
        toolbox: {
            show: true,
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: [{
            type: 'category',
            boundaryGap: false,
            data: dataList
        }],
        yAxis: {
            type: 'value',
            axisLabel: {
                formatter: '{value}'
            },
            axisPointer: {
                snap: true
            }
        },
        visualMap: {
            show: false,
            dimension: 0,
        },
        series: [
            {
                name: tipTitle,
                type: 'line',
                smooth: true,
                itemStyle: {
                    normal: {
                        //设置折点颜色
                        color: 'black',
                        //设置折线颜色
                        lineStyle: {
                            color: 'red'
                        }
                    }
                },
                data: valueList,
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option, true);
    //window.onresize = myChart.resize;
}

//初始化柱状图统计表格
function InitEchartBar(id, title, dataList, valueList, tipTitle) {
    // 基于准备好的dom，初始化echarts实例
    let myChart = echarts.init(document.getElementById(id));
    let option = {
        title: {
            text: title,
            x: 'center',
            y: 30
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            },
            formatter: function (res) {
                return "时间:" + res[0].name + "<br />" + tipTitle + ":<label >" + res[0].value + "</label>";
            }
        },
        grid: {
            x: 60,
            y: 100,
            x2: 100,
            y2: 100,
        },
        xAxis: {
            type: 'category',
            data: dataList
        },

        yAxis: {
            type: 'value'
        },
        legend: {
            orient: 'vertical',
            left: 'buttom',
            data: dataList,
            show: true
        },
        series: [{
            data: valueList,
            type: 'bar'
        }]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
}

//按照属性对数据进行分组，并对某项数据进行累加
function DataGroupBy(data, a, b = null) {
    //构造部门统计数据
    var noRepeatData = JSON.parse(data).reduce(
        (current, next) => {
            if (!current[next[a]]) {
                current[next[a]] = next;
            }
            else if (b != null) {
                //current[next[a]][b] += next[b];
                current[next[a]][b] = dcmAdd(current[next[a]][b], next[b]);
            }
            return current;
        }, {}
    );
    noRepeatData = Object.values(noRepeatData);
    return noRepeatData;
}

//获取某个项目下的所有的人员计划表类型的人员
function GetProjectPeople(http, ProjectId) {
    var arr = [];
    http.post('/Project1/GetProjectPeople', { ProjectId: ProjectId }).then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取某个项目下的所有的人员计划表类型的人员
function GetProjectWorkPlan (http, ProjectId) {
    var arr = [];
    http.post('Project1/GetProjectWorkPlan', { ProjectId: ProjectId }).then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取某个项目下的所有的人员计划表类型的人员
function GetProjectDevice  (http, ProjectId) {
    var arr = [];
    http.post('Project1/GetProjectDevice ', { ProjectId: ProjectId }).then(res => {
        for (var i = 0; i < res.data.length; i++) {
            arr.push(res.data[i]);
        }
    });
    return arr;
}

//获取配置路径下所有的图片信息，并构造图片和加入相册
async function Isjurisdiction(http, type) {
    var arr = "";
    await http.get("Device/Isjurisdiction?type=" + type).then(res => {
        arr = res.data;
    })
    return arr
}

//两个时间相差天数 兼容firefox chrome
function datedifference(sDate1, sDate2) {    //sDate1和sDate2是2006-12-18格式
    var dateSpan, tempDate, iDays;
    sDate1 = Date.parse(sDate1);
    sDate2 = Date.parse(sDate2);
    dateSpan = sDate2 - sDate1;
    dateSpan = Math.abs(dateSpan);
    iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
    return iDays;
}

//判断两个日期是否属于同一月
function isSameMonth(oldDate, newDate) {
    oldDate = new Date(oldDate);
    newDate = new Date(newDate);
    var oldYear = oldDate.getYear();
    var oldMonth = oldDate.getMonth();
    var newYear = newDate.getYear();
    var newMonth = newDate.getMonth();
    if (oldYear == newYear && oldMonth == newMonth) {
        return true;
    }
    else {
        return false;
    }
}

//判断两个日期是否属于同一周
function isSameWeek(oldDate, newDate) {
    oldDate = new Date(oldDate);
    newDate = new Date(newDate);
    var oneDayTime = 1000 * 60 * 60 * 24;
    var old_count = parseInt(oldDate.getTime() / oneDayTime);
    var now_other = parseInt(newDate.getTime() / oneDayTime);
    return parseInt((old_count + 4) / 7) == parseInt((now_other + 4) / 7);
}


function toPrice (val, type) { // 值，符号
  if (val === null || val === undefined || val === '') {
    return '—';
  } else {
    var data = Number(val).toFixed(2).split('.');
    var data2 = data[0].split('').reverse().join('');
    var newData = '';
    if (parseInt((data2.length - 1) / 3) > 0) {
      var count = 0;
      do {
        newData = newData + data2.slice(count * 3, count * 3 + 3) + ',';
        count = count + 1;
      } while (parseInt((data2.length - 1) / 3) >= count);
    }
    if (type) {
      return type + newData.split('').reverse().join('').slice(1) + '.' + data[1];
    } else {
      return newData.split('').reverse().join('').slice(1) + '.' + data[1];
    }
  }
}


export {
    http,
    dcmAdd,
    dcmRedu,
    accMul,
    accDiv,
    GetAllDepartment,
    GetAllOfficialSeal,
    GetAllProjectUnitAttribute,
    GetAllDeviceState,
    GetAllDeviceCategory,
    GetCompanyAllUsers,
    GetAllProject,
    GetAllCustomer,
    GetAllContractType,
    GetAllContract,
    GetPayArray,
    formatDateTime,
    SetDeviceNumber,
    getDiffentList,
    DeleteNullArr,
    GetAllFinanceCategory,
    arrayByIdtoobj,
    GetAllFinanceBankCard,
    GetAllExpressCompany,
    fmtDate,
    Arabia_To_SimplifiedChinese,
    InitStateColum,
    AddAuditPeople,
    getAllUsers,
    GetAllDevice,
    GetAllVehicle,
    GetAllVehicleAndok,
    GetAllTypes,
    formatTime,

    //文件下载
    DownLoadFile, 
    //获取相关数据注入
    _getAllDepartment,
    _getAllProject,
    _getAllCustomer,

    GetDataUserNameById,
    GetUserNameById,
    GetDepartmentNameById,
    GetProjectNameById,
    GetpayeerNameById,


    //获取文件相关数据信息
    GetAllFileByUrl,


    //修
    monthdifference,
    GetAllRole,
    jsGetAge,
    GetAllDutyMains,
    setecharts,
    InitEchartRenderMore,
    InitEchartPie,
    DataGroupBy,
    InitEchartBar_Total,
    InitEchartBar_TotalTwo,
    InitEchartBar_MoreData,
    InitEchartRender,
    InitEchartBar,
    NodGetAllGasCards,
    GetAllGasCards,


    GetProjectPeople,
    GetProjectDevice,
    GetProjectWorkPlan,
    Isjurisdiction,
    datedifference,
    isSameMonth,
    isSameWeek,
    formatDate,
    exportTable,
	CheckAmount,
	UpLoadFileType,
	toPrice, 
}
